package org.example.service;

import org.example.mapper.UserMapper;
import org.example.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Locale;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public List<User> list() {
        return userMapper.selectAll();
    }

    public List<User> list2() {
        return userMapper.selectAll2();
    }

    public int insert1(String username, String password) {
        return userMapper.insert1(username, password);
    }

    public int insert2(User user) {
        return userMapper.insert2(user);
    }

    public List<User> queryByGithub(String github) {
        User params = new User();
        params.setGithub(github);
        return userMapper.queryByGithub(params);
    }

    public int update(User user) {
        return userMapper.updateById(user);
    }

    public int deleteByNickname(String nickname) {
        return userMapper.deleteByNickname(nickname);
    }

    public List<User> selectOrderBy(String columnName, String orderBy) {
        return userMapper.selectOrderBy(columnName, orderBy);
    }

    public List<User> selectList(String nickname) {
        return userMapper.selectList(nickname);
    }

    public List<User> selectOneToMany() {
        return userMapper.selectOneToMany();
    }

    public User selectOne(User user) {
        return userMapper.selectOne(user);
    }
}
